package de.casino.strategies;

import de.casino.AbstractStrategy;
import de.casino.Spin;

public class DoubleNumberMartingaleStrategy extends AbstractStrategy {

   public DoubleNumberMartingaleStrategy(int startMoney, int startBet,
         int tableLimit) {
      super(startMoney, startBet, tableLimit);
   }

   int counter = 0;

   protected void handleSpin(Spin s) {
      counter++;
      if (s.getNumber() == 1 || s.getNumber() == 2) {
         bankroll += currentBet * 18;
         currentBet = startBet;
         counter = 0;
      } else {
         if (counter > 17) {
            currentBet *= 2;
            if (tableLimit > -1 && currentBet > tableLimit) {
               currentBet = startBet;
            }
            counter = 0;
         }
      }
   }

}
